Function Reference

_GUICtrlTreeViewSetIndent

Sets the width of indentation for a treeview control and redraws the control to reflect the new width.

#Include <GuiTreeView.au3>
_GUICtrlTreeViewSetIndent($i_treeview, $i_indent)

 

Parameters

$i_treeview controlID
$i_indent Width, in pixels, of the indentation.

 

Return Value

None.

 

Remarks

$i_indent
    If this parameter is less than the system-defined minimum width,
    the new width is set to the system-defined minimum.

 

Related

_GUICtrlTreeViewGetIndent

 

Example


#include <GUIConstantsEx.au3>
#include <GuiTreeView.au3>
#include <GuiStatusBar.au3>

opt("MustDeclareVars", 1)

Global Const $Turquoise = 0x40e0d0
Global Const $Crimson = 0xDC143C
Global Const $White = 0xFFFFFF

Dim $myGui, $treeview, $generalitem, $displayitem, $aboutitem
Dim $compitem, $useritem, $resitem, $otheritem, $Status, $startlabel, $aboutlabel
Dim $compinfo, $msg, $cancelbutton

$myGui = GUICreate("TreeView Set Indent", 392, 254)

$treeview = GUICtrlCreateTreeView(6, 6, 100, 150, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_DISABLEDRAGDROP, $TVS_SHOWSELALWAYS), $WS_EX_CLIENTEDGE)
$generalitem = GUICtrlCreateTreeViewItem("General", $treeview)
$displayitem = GUICtrlCreateTreeViewItem("Display", $treeview)
$aboutitem = GUICtrlCreateTreeViewItem("About", $generalitem)
$compitem = GUICtrlCreateTreeViewItem("Computer", $generalitem)
$useritem = GUICtrlCreateTreeViewItem("User", $generalitem)
$resitem = GUICtrlCreateTreeViewItem("Resolution", $displayitem)
$otheritem = GUICtrlCreateTreeViewItem("Other", $displayitem)
$Status = _GuiCtrlStatusBarCreate($myGui, -1, "")
_GuiCtrlStatusBarSetSimple($Status)

$startlabel = GUICtrlCreateLabel("TreeView Demo", 190, 90, 100, 20)
$aboutlabel = GUICtrlCreateLabel("This little scripts demonstates the using of a treeview-control.", 190, 70, 100, 60)
GUICtrlSetState(-1, $GUI_HIDE)
$compinfo = GUICtrlCreateLabel("Name:" & @TAB & @ComputerName & @LF & "OS:" & @TAB & @OSVersion & @LF & "SP:" & @TAB & @OSServicePack, 120, 30, 200, 80)
GUICtrlSetState(-1, $GUI_HIDE)

$cancelbutton = GUICtrlCreateButton("Cancel", 180, 185, 70, 20)

_GUICtrlTreeViewSetBkColor ($treeview, $Turquoise)
_GUICtrlTreeViewSetTextColor ($treeview, $Crimson)
_GUICtrlTreeViewSetLineColor ($treeview, $White)
_GUICtrlTreeViewSetIndent ($treeview, 10)
GUISetState()
_GuiCtrlStatusBarSetText($Status,"Indent: " & _GUICtrlTreeViewGetIndent ($treeview) & " in pixels",255)
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $cancelbutton Or $msg = $GUI_EVENT_CLOSE
            ExitLoop
           
        Case $msg = $generalitem
            ConsoleWrite($generalitem & @LF)
            GUIChangeItems($aboutlabel, $compinfo, $startlabel, $startlabel)
           
        Case $msg = $aboutitem
            GUICtrlSetState($compinfo, $GUI_HIDE)
            GUIChangeItems($startlabel, $startlabel, $aboutlabel, $aboutlabel)
           
        Case $msg = $compitem
            GUIChangeItems($startlabel, $aboutlabel, $compinfo, $compinfo)
           
    EndSelect
WEnd

GUIDelete()
Exit

Func GUIChangeItems($hidestart, $hideend, $showstart, $showend)
    Local $idx
   
    For $idx = $hidestart To $hideend
        GUICtrlSetState($idx, $GUI_HIDE)
    Next
    For $idx = $showstart To $showend
        GUICtrlSetState($idx, $GUI_SHOW)
    Next
EndFunc   ;==>GUIChangeItems